JuliaArrays / IndirectArrays.jl

Julia implementation of indexed or "lookup" arrays
Other
19 stars 7 forks source link

broadcasting element-wise operation without materializing the data into `Array`? #27

Open johnnychen94 opened 2 years ago

johnnychen94 commented 2 years ago
A = IndirectArray(rand(1:5, 64, 64), rand(1:10, 5))
float.(A) # what's needed to make this still an IndirectArray?

# internally, I'd like to make it work equivalently to
_float(A::IndirectArray) = IndirectArray(A.index, float.(A.values))
timholy commented 2 years ago

Since broadcasting acts on values only, I think (?) we could create custom copy!(::Broadcastable) methods for IndirectArray.