AxisArrays.jl icon indicating copy to clipboard operation
AxisArrays.jl copied to clipboard

Uninitialized AxisArray constructor

Open GordStephen opened this issue 7 years ago • 1 comments

Is there any reason there's currently no constructor to create an uninitialized AxisArray? I.e. something like:

AxisArray{T,N,D}(axes::Axis...)

This seems pretty straightforward, I'm happy to submit a PR - just wanted to check that it wasn't intentionally omitted for some reason.

There's a potential conflict between N and length(axes) - presumably N would be the canonical dimensionality with axes either truncated or extended (with the standard default dimension names and zero-length?) as needed.

Edit: To avoid the over/under-specification, an alternative would be to deviate from the AxisArray type parameter order specification and use AxisArray{T,D} or just AxisArray{T} (where T is a concrete child of AbstractArray). I assume that's frowned upon though - if it's even possible (I'm not clear on how exactly type parametrization works on constructor methods or methods in general, really - any recommended resources for that?).

GordStephen avatar Mar 01 '17 18:03 GordStephen

Sure, this seems like a reasonable feature. We just need to figure out what the right API should be. I think I'd be ok defaulting to creating an Array as storage. In that case, we can mirror how those constructors work; Array{T,2}(1) is an error.

I'm not sure how frequently folks would want to specify a non-Array but be in a situation where similar is awkward.

mbauman avatar Mar 02 '17 16:03 mbauman