meggart / DiskArrays.jl

Other
72 stars 13 forks source link

copyto! fails when one of the axes has a zero length index #168

Closed felixcremer closed 4 months ago

felixcremer commented 4 months ago

Using copyto! with a zero length axis breaks with a DiskArray but succeeds with a normal Array. This breaks the show method of DimArrays with a DiskArray in some circumstances see https://github.com/rafaqz/DimensionalData.jl/issues/670.

    a = collect(reshape(1:90, 10, 9))
    a_disk = AccessCountDiskArray(a; chunksize=(5, 3))
        x_empty = Matrix{Int64}(undef, 0,2)
        copyto!(x_empty, CartesianIndices((1:0, 1:2)), a_disk, CartesianIndices((8:7, 8:9))) # This fails
        copyto!(x_empty, CartesianIndices((1:0, 1:2)), a, CartesianIndices((8:7, 8:9))) # This works