@@ -2,7 +2,6 @@ module SerializedArrays
22
33using ConstructionBase: constructorof
44using DiskArrays: DiskArrays, AbstractDiskArray, Unchunked
5- using LinearAlgebra: LinearAlgebra, mul!
65using Serialization: deserialize, serialize
76
87struct SerializedArray{T,N,A<: AbstractArray{T,N} ,Axes} <: AbstractDiskArray{T,N}
@@ -14,21 +13,25 @@ Base.axes(a::SerializedArray) = getfield(a, :axes)
1413arraytype (a:: SerializedArray{<:Any,<:Any,A} ) where {A} = A
1514
1615function SerializedArray (file:: String , a:: AbstractArray )
17- serialize (file, a )
16+ serialize (file, vec (a) )
1817 ax = axes (a)
1918 return SerializedArray {eltype(a),ndims(a),typeof(a),typeof(ax)} (file, ax)
2019end
2120function SerializedArray (a:: AbstractArray )
2221 return SerializedArray (tempname (), a)
2322end
2423
24+ function Base. convert (arrayt:: Type{<:SerializedArray} , a:: AbstractArray )
25+ return arrayt (a)
26+ end
27+
2528function Base. similar (a:: SerializedArray , elt:: Type , dims:: Tuple{Vararg{Int}} )
2629 return constructorof (arraytype (a)){elt}(undef, dims... )
2730end
2831
2932function Base. copy (a:: SerializedArray )
3033 arrayt = arraytype (a)
31- return convert (arrayt, deserialize (file (a))):: arrayt
34+ return convert (arrayt, reshape ( deserialize (file (a)), axes (a))):: arrayt
3235end
3336
3437Base. size (a:: SerializedArray ) = length .(axes (a))
@@ -106,15 +109,4 @@ function Base.copy(broadcasted::Broadcasted{SerializedArrayStyle{N}}) where {N}
106109 return BroadcastSerializedArray (flatten (broadcasted))
107110end
108111
109- #
110- # LinearAlgebra
111- #
112-
113- function LinearAlgebra. mul! (
114- a_dest:: AbstractMatrix , a1:: SerializedArray , a2:: SerializedArray , α:: Number , β:: Number
115- )
116- mul! (a_dest, copy (a1), copy (a2), α, β)
117- return a_dest
118- end
119-
120112end
0 commit comments