Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should use broadcast for vector space calculations? #187

Open
vpuri3 opened this issue Jan 31, 2022 · 1 comment
Open

should use broadcast for vector space calculations? #187

vpuri3 opened this issue Jan 31, 2022 · 1 comment

Comments

@vpuri3
Copy link
Member

vpuri3 commented Jan 31, 2022

# vector space calculations
@inferred x+5
@inferred 5+x
@inferred x-5
@inferred 5-x

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
@ChrisRackauckas
Copy link
Member

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

vpuri3 added a commit to vpuri3/RecursiveArrayTools.jl that referenced this issue Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants