Skip to content

Commit 5640f81

Browse files
committed
parent(A::AxisArray) = A.data
1 parent f0fe6d3 commit 5640f81

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/core.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ end
246246
@inline Base.indices(A::AxisArray, Ax::Axis) = indices(A.data, axisdim(A, Ax))
247247
@inline Base.indices{Ax<:Axis}(A::AxisArray, ::Type{Ax}) = indices(A.data, axisdim(A, Ax))
248248
Base.convert{T,N}(::Type{Array{T,N}}, A::AxisArray{T,N}) = convert(Array{T,N}, A.data)
249+
Base.parent(A::AxisArray) = A.data
249250
# Similar is tricky. If we're just changing the element type, it can stay as an
250251
# AxisArray. But if we're changing dimensions, there's no way it can know how
251252
# to keep track of the axes, so just punt and return a regular old Array.

test/core.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
A = AxisArray(reshape(1:24, 2,3,4), .1:.1:.2, .1:.1:.3, .1:.1:.4)
22
@test_throws ArgumentError AxisArray(reshape(1:24, 2,3,4), .1:.1:.1, .1:.1:.3, .1:.1:.4)
33
@test_throws ArgumentError AxisArray(reshape(1:24, 2,3,4), .1:.1:.1, .1:.1:.3)
4+
@test parent(A) === reshape(1:24, 2,3,4)
45
# Test iteration
56
for (a,b) in zip(A, A.data)
67
@test a == b

0 commit comments

Comments
 (0)