RecursiveArrayTools.jl icon indicating copy to clipboard operation
RecursiveArrayTools.jl copied to clipboard

should use broadcast for vector space calculations?

Open vpuri3 opened this issue 3 years ago • 1 comments

https://github.com/SciML/RecursiveArrayTools.jl/blob/569a07e9f0ecaacef167ee52e8101122a25c9b4a/test/partitions_test.jl#L78-L82

What's the use case for the vector space interface? using broadcast, rather than overloading +,- would be consistent with AbstractArray interface.

julia> 2 + rand(2)
ERROR: MethodError: no method matching +(::Int64, ::Vector{Float64})
For element-wise addition, use broadcasting with dot syntax: scalar .+ array


julia> 2 .+ rand(2)
2-element Vector{Float64}:
 2.50859350057021
 2.7682555961902384

vpuri3 avatar Jan 31 '22 12:01 vpuri3

It's just old pre-v1.0 stuff probably.

ChrisRackauckas avatar Jan 31 '22 13:01 ChrisRackauckas