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

Adding argument to eigvals #184

Closed
mfalt opened this issue Nov 4, 2019 · 5 comments
Closed

Adding argument to eigvals #184

mfalt opened this issue Nov 4, 2019 · 5 comments

Comments

@mfalt
Copy link
Contributor

mfalt commented Nov 4, 2019

The ordering of roots of polynomials is changing with version Julia > 1.2.
Would you be interested in adding a keyword to roots that propagates to eigvals to change this?
In particular, I want to be able to keep the default "ordering" from LAPACK where complex-conjugates are sorted together (JuliaControl/ControlSystems.jl#236)

@jverzani
Copy link
Member

jverzani commented Nov 4, 2019

That's a good idea! Thanks. Did you want to work out a pull request?

@mfalt
Copy link
Contributor Author

mfalt commented Nov 4, 2019

Sure, I see two alternatives, either a simple kwargs... on definition of roots and input to eigvals, i.e. the user has to be careful about which kwargs to pass or an explicit sortby as kwarg on the root input and in the function something like:

@static if VERSION > v"1.2.0-DEV.0"
    D = eigvals(companion, sortby=sortby)
else
    D = eigvals(companion)
    if sortby !== nothing
        sort!(D, by = sortby)
    end
end

For me it doesn't really matter

@mfalt
Copy link
Contributor Author

mfalt commented Nov 4, 2019

Since I'm doing updates anyway, what do you think of setting var=p.var as kwarg in printpoly? I.e.

printpoly(io::IO, p::Poly{T}, mimetype=MIME"text/plain"(); descending_powers=false, offset::Int=0)

to

printpoly(io::IO, p::Poly{T}, mimetype=MIME"text/plain"(); descending_powers=false, offset::Int=0, var=p.var)

This would allow us to remove most of the code in:
https://github.com/JuliaControl/ControlSystems.jl/blob/master/src/types/SisoTfTypes/polyprint.jl
which is a bit of a headache since it broke when you updated the print interface

@jverzani
Copy link
Member

jverzani commented Nov 4, 2019 via email

@mfalt
Copy link
Contributor Author

mfalt commented Nov 9, 2019

Feel free to close this and tag a version.

@jverzani jverzani closed this as completed Apr 8, 2020
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