@@ -4,7 +4,8 @@ export SerializedArray, disk, memory
4
4
5
5
using Base. PermutedDimsArrays: genperm
6
6
using ConstructionBase: constructorof
7
- using DiskArrays: DiskArrays, AbstractDiskArray, Unchunked, readblock!, writeblock!
7
+ using DiskArrays:
8
+ DiskArrays, AbstractDiskArray, PermutedDiskArray, Unchunked, readblock!, writeblock!
8
9
using Serialization: deserialize, serialize
9
10
10
11
adapt_serialized (to, x) = adapt_structure_serialized (to, x)
@@ -159,26 +160,31 @@ end
159
160
# PermutedSerializedArray
160
161
#
161
162
162
- struct PermutedSerializedArray{T,N,P<: PermutedDimsArray {T,N} } < :
163
+ struct PermutedSerializedArray{T,N,perm,iperm, P<: AbstractArray {T,N} } < :
163
164
AbstractSerializedArray{T,N}
164
- permuted_parent :: P
165
+ parent :: P
165
166
end
166
- Base. parent (a:: PermutedSerializedArray ) = parent ( getfield (a, :permuted_parent ) )
167
+ Base. parent (a:: PermutedSerializedArray ) = getfield (a, :parent )
167
168
168
169
file (a:: PermutedSerializedArray ) = file (parent (a))
169
170
170
- perm (a:: PermutedSerializedArray ) = perm (a. permuted_parent)
171
- perm (:: PermutedDimsArray{<:Any,<:Any,p} ) where {p} = p
172
-
173
- iperm (a:: PermutedSerializedArray ) = iperm (a. permuted_parent)
174
- iperm (:: PermutedDimsArray{<:Any,<:Any,<:Any,ip} ) where {ip} = ip
171
+ # TODO : Use `TypeParameterAccessors.jl`.
172
+ perm (a:: PermutedDimsArray{<:Any,<:Any,p} ) where {p} = p
173
+ perm (a:: PermutedDiskArray{<:Any,<:Any,p} ) where {p} = p
174
+ perm (a:: PermutedSerializedArray{<:Any,<:Any,p} ) where {p} = p
175
+ # TODO : Use `TypeParameterAccessors.jl`.
176
+ iperm (a:: PermutedDimsArray{<:Any,<:Any,<:Any,ip} ) where {ip} = ip
177
+ iperm (a:: PermutedDiskArray{<:Any,<:Any,ip} ) where {ip} = ip
178
+ iperm (a:: PermutedSerializedArray{<:Any,<:Any,<:Any,ip} ) where {ip} = ip
175
179
176
180
Base. axes (a:: PermutedSerializedArray ) = genperm (axes (parent (a)), perm (a))
177
- Base. size (a:: PermutedSerializedArray ) = length .( axes (a))
181
+ Base. size (a:: PermutedSerializedArray ) = map (length, axes (a))
178
182
179
- function PermutedSerializedArray (a:: AbstractArray , perm)
180
- a′ = PermutedDimsArray (a, perm)
181
- return PermutedSerializedArray {eltype(a),ndims(a),typeof(a′)} (a′)
183
+ function PermutedSerializedArray (a:: AbstractArray , p)
184
+ # This returns a `PermutedDiskArray` as of:
185
+ # https://github.com/JuliaIO/DiskArrays.jl/pull/249
186
+ a′ = PermutedDimsArray (a, p)
187
+ return PermutedSerializedArray {eltype(a),ndims(a),perm(a′),iperm(a′),typeof(a)} (a)
182
188
end
183
189
184
190
function Base. permutedims (a:: AbstractSerializedArray , perm)
0 commit comments