@@ -152,6 +152,9 @@ const NamedDimsAxis = AbstractNamedUnitRange{
152
152
153
153
# Generic constructor.
154
154
function nameddims (a:: AbstractArray , nameddimsindices)
155
+ if iszero (ndims (a))
156
+ return constructorof_nameddims (typeof (a))(a, nameddimsindices)
157
+ end
155
158
# TODO : Check the shape of `nameddimsindices` matches the shape of `a`.
156
159
arrtype = mapreduce (nameddimsarraytype, combine_nameddimsarraytype, nameddimsindices)
157
160
return arrtype (a, to_nameddimsindices (a, nameddimsindices))
@@ -781,7 +784,7 @@ function set_promote_shape(
781
784
ax1:: Tuple{AbstractNamedUnitRange,Vararg{AbstractNamedUnitRange,N}} ,
782
785
ax2:: Tuple{AbstractNamedUnitRange,Vararg{AbstractNamedUnitRange,N}} ,
783
786
) where {N}
784
- perm = getperm (ax1, ax2 )
787
+ perm = getperm (ax2, ax1 )
785
788
ax2_aligned = map (i -> ax2[i], perm)
786
789
ax_promoted = promote_shape (dename .(ax1), dename .(ax2_aligned))
787
790
return named .(ax_promoted, name .(ax1))
@@ -813,7 +816,7 @@ function set_check_broadcast_shape(
813
816
ax1:: Tuple{AbstractNamedUnitRange,Vararg{AbstractNamedUnitRange,N}} ,
814
817
ax2:: Tuple{AbstractNamedUnitRange,Vararg{AbstractNamedUnitRange,N}} ,
815
818
) where {N}
816
- perm = getperm (ax1, ax2 )
819
+ perm = getperm (ax2, ax1 )
817
820
ax2_aligned = map (i -> ax2[i], perm)
818
821
check_broadcast_shape (dename .(ax1), dename .(ax2_aligned))
819
822
return nothing
0 commit comments