AxisArrays.jl
AxisArrays.jl copied to clipboard
Add more join methods to avoid confuse dispatch to fallback Base.join
Currently join
dispatches on the typed positional arguments As::AxisArray{T,N,D,Ax}...
. Every array must have the same parameters for this to be called. With
A = AxisArray(1:3,1:3)
B = AxisArray(0. + 1:3,2:4)
one gets
julia> join(A,B)
"1[1.0, 2.0, 3.0]2[1.0, 2.0, 3.0]3"
julia> @which join(A,B)
join(strings, delim) in Base at strings/io.jl:277
This is "correct" inasmuch as that is the behavior for AbstractArrays
but is surprising for AxisArrays. If this behavior is intentional probably good to explicitly document. Alternatively, I would propose that additional methods for join
be defined to handle in cases when the parameters of the the AxisArrays don't match.
Possible appropriate behaviors include:
- When types don't match, throw an error
- When only the eltypes (the
T
's) don't match promote eltypes and call on result
Possible maybe appropriate behaviors include:
- When
N
doesn't match but no matching axes have length one expand these dims and call on result - When only the array types (the
D
s) don't match trying to promote Ds/ convert to dense then call on result
There are probably other options could be added to this list. Happy to hear thoughts on what makes sense here and implement if consensus on items.