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

Support linspace #79

Open
ssfrr opened this issue Dec 6, 2015 · 2 comments
Open

Support linspace #79

ssfrr opened this issue Dec 6, 2015 · 2 comments

Comments

@ssfrr
Copy link
Contributor

ssfrr commented Dec 6, 2015

I recently tried getting a SIQuantity range using linspace, but it's not supported:

julia> using SIUnits
julia> using SIUnits.ShortUnits
julia> linspace(0s, 10s, 100)
ERROR: MethodError: `linspace` has no method matching linspace(::SIUnits.SIQuantity{Int64,0,0,1,0,0,0,0,0,0}, ::SIUnits.SIQuantity{Int64,0,0,1,0,0,0,0,0,0}, ::Int64)
Closest candidates are:
  linspace{T<:AbstractFloat}(::T<:AbstractFloat, ::T<:AbstractFloat, ::Real)
  linspace(::Real, ::Real, ::Real)
  linspace{T<:ColorTypes.Color{T,N}}(::T<:ColorTypes.Color{T,N}, ::T<:ColorTypes.Color{T,N}, ::Any)

I started looking into an implementation but it looks like you already went through this with Range, and decided to re-implement all the Range stuff with SIRange, so I figured I'd get some early feedback. Do you think that's the best way forward with LinSpace as well? I assume there must be use cases for non-Real SIUnit values or else you would have just made SIQuantity{T<:Real, ...} <: Real instead of the more general Number, right?

I have a feeling that this is an application where the Trait / abstract interface stuff will provide a cleaner solution, so another option might just be to wait until that settles down.

@ChrisRackauckas
Copy link

Ran into this issue (see the linked issue). Is linspace support planned?

@timholy
Copy link
Collaborator

timholy commented Sep 13, 2016

Relevant: JuliaLang/julia#17408

Unitful avoids defining linspace because of similar difficulties. I really do suspect we need a LinSpaces package.

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

3 participants