|
1 | | -#= |
2 | 1 | """ |
| 2 | + reshape(A::AbstractAxisIndices, shape) |
| 3 | +
|
| 4 | +Reshape the array and axes of `A`. |
| 5 | +
|
| 6 | +## Examples |
3 | 7 | ```jldoctest |
| 8 | +julia> using AxisIndices |
| 9 | +
|
4 | 10 | julia> A = reshape(AxisIndicesArray(Vector(1:8), [:a, :b, :c, :d, :e, :f, :g, :h]), 4, 2); |
5 | 11 |
|
6 | 12 | julia> axes(A) |
7 | | -(Axis([:a, :b, :c, :d]), SimpleAxis(OneTo(2))) |
| 13 | +(Axis([:a, :b, :c, :d] => Base.OneTo(4)), SimpleAxis(Base.OneTo(2))) |
8 | 14 |
|
9 | 15 | julia> axes(reshape(A, 2, :)) |
10 | | -(Axis([:a, :b]), SimpleAxis(OneTo(4))) |
| 16 | +(Axis([:a, :b] => Base.OneTo(2)), SimpleAxis(Base.OneTo(4))) |
| 17 | +``` |
11 | 18 | """ |
12 | | -=# |
13 | | -#= |
14 | | -function Base.reshape(A::AbstractAxisIndices, shp::Tuple{Vararg{Union{Colon, Int64},N}}) where {N} |
15 | | - p = reshape(parent(A), shp) |
16 | | - return unsafe_reconstruct(A, p, reshape_axes(A, axes(p))) |
17 | | -end |
18 | | -=# |
19 | | - |
20 | 19 | function Base.reshape(A::AbstractAxisIndices, shp::NTuple{N,Int}) where {N} |
21 | 20 | p = reshape(parent(A), shp) |
22 | 21 | return unsafe_reconstruct(A, p, reshape_axes(naxes(A, Val(N)), axes(p))) |
|
0 commit comments