shared conversions

This commit is contained in:
Mike J Innes 2017-06-05 19:04:14 +01:00
parent b2baf512e1
commit bf3db99bc1
2 changed files with 2 additions and 9 deletions

View File

@ -6,9 +6,6 @@ end
Batch(xs) = Batch(Storage(xs))
convert{T,S}(::Type{Batch{T,S}},storage::S) =
Batch{T,S}(storage)
# TODO: figure out how to express this as a generic convert
function rebatch(xs)
dims = ndims(xs)-1
@ -35,9 +32,6 @@ end
Seq(xs) = Seq(Storage(xs))
convert{T,S}(::Type{Seq{T,S}},storage::S) =
Seq{T,S}(storage)
BatchSeq{T<:Seq} = Batch{T}
function rebatchseq(xs)

View File

@ -31,13 +31,12 @@ typename(b::Type{<:BatchLike}) =
Juno.trim(collect(b)))
end
convert{T,S}(B::Type{<:BatchLike{T,S}},storage::S) = B(storage)
struct Storage{T,S} <: BatchLike{T,S}
data::S
end
convert{T,S}(::Type{Storage{T,S}},storage::S) =
Storage{T,S}(storage)
allequal(xs) = all(x -> x == first(xs), xs)
function (::Type{Storage{T,S}}){T,S}(xs, storage::S)