meggart / DiskArrays.jl

Other
79 stars 16 forks source link

lazy reverse(a; dims=n) with keyword dimension #113

Closed felixcremer closed 8 months ago

felixcremer commented 1 year ago

It would be good to dispatch on the DiskArray implementation for the lazy reverse when one specifies the dimension by a keyword argument. It dispatches directly if the dimension is the second positional argument, but the keyword argument is dispatched into the default Base implementation.

a:: DiskArray

julia> reverse(a, dims=1) # Non lazy
10000×10000 Matrix{UInt8}:
 0x00  0x00  …  0x00  0x00
 0x00  0x00     0x00  0x00
 0x00  0x00     0x00  0x00
 0x00  0x00     0x00  0x00
 0x00  0x00     0x00  0x00
 0x00  0x00  …  0x00  0x00
 0x00  0x00     0x00  0x00
 0x00  0x00     0x00  0x00
 0x00  0x00     0x00  0x00
    ⋮        ⋱        
 0x00  0x00     0x00  0x00
 0x00  0x00     0x00  0x00
 0x00  0x00     0x00  0x00
 0x00  0x00  …  0x00  0x00
 0x00  0x00     0x00  0x00
 0x00  0x00     0x00  0x00
 0x00  0x00     0x00  0x00
 0x00  0x00     0x00  0x00

julia> reverse(a, 1) # Lazy 
Disk Array with size 10000 x 10000
rafaqz commented 1 year ago

Just needs to add the keyword version here: https://github.com/meggart/DiskArrays.jl/blob/main/src/array.jl#L31

rafaqz commented 8 months ago

This was fixed by #150