fhs / NPZ.jl

A Julia package that provides support for reading and writing Numpy .npy and .npz files
Other
117 stars 16 forks source link

Cannot write LinSpace #16

Closed mwil closed 5 years ago

mwil commented 7 years ago

In Julia v0.5 the output type of the linspace() function has been changed to LinSpace, which is not a subtype of Array, but of AbstractArray. Because of this, it is not seamlessly possible to write the output of linspace() and similar functions.

> NPZ.npzwritearray("test.npz", linspace(1,2))
ERROR: MethodError: no method matching npzwritearray(::String, ::LinSpace{Float64})

It works when you explicitly convert it to Array, but wouldn't it be better to change the signature of npzwritearray() to accept AbstractArray?

fhs commented 5 years ago

I think this has been fixed by https://github.com/fhs/NPZ.jl/commit/0bd3fbfe3b37b4dbcbc531a72da4e878f66a7292