Vexatos / CircularArrays.jl

Multi-dimensional arrays with fixed size and circular indexing.
MIT License
38 stars 12 forks source link

Type consistency #15

Closed putianyi889 closed 3 years ago

putianyi889 commented 3 years ago

Operations on CircularArrays give usual Arrays instead:

julia> CircularArray(rand(3,3)) .+ 1
3×3 Matrix{Float64}:
 1.59308  1.58855  1.67183
 1.86402  1.33325  1.31673
 1.15693  1.32027  1.24405
Vexatos commented 3 years ago

This bug is specific to vectorized calls, thanks for reporting it. I already have a fix but I will need to wait a bit before pushing it to make sure it doesn't break interactions with other packages that I am currently testing.

For now, you should be able to use the map function to get around this issue.

julia> map(e -> e + 1, CircularArray(rand(3,3)))
3×3 CircularArray(::Matrix{Float64}):
 1.25159  1.76918  1.16795
 1.54877  1.81786  1.57196
 1.68487  1.82078  1.94709
putianyi889 commented 3 years ago

I'm just using CircularArray(A .+ 1) now. Thanks for reply.

Vexatos commented 3 years ago

This will be fixed in the next version. Thanks again for reporting it.