-
Notifications
You must be signed in to change notification settings - Fork 74
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
Just a question #308
Comments
I have a mean to obtain this
but I would prefer the elegant way you chose. |
Yeah it is a good question. I suspect that you get For the first concatenation |
The
works. Certainly, I can try to implement a complete set of concatenation function (i.e., And, of course, thanks for the fast reply. |
Yes, concatenation with Polynomial objects falls back to Julia's default, which means you have to get the promotion mechanisms set up as you want them. (This is why my suspicion about variables being different is some cause of your "Any" type). The promotion is handled in the |
Thanks for the hint. I implemented the promotion rule, but it still remain two issues. The first one concerns the possibility of different variables (this is an issue for
I set the sampling time
Unfortunately, I see no simple solution. I must probably implement a new set of concatenation functions. |
I implemented a set of concatenation functions for polynomial matrices. It is now possible to generate polynomial matrices with correctly set variable names. For example, the following examples combines scalars, matrices and UniformScalings into one matrix, with the type automatically adjusted and the variable names correctly set:
If you want to include this stuff in the |
Neat. I'm hoping to make this easier for you. I'm almost done with a PR that moves the polynomial symbol into the type parameter so things like promote will just work. It took a fair amount of code churn, so might be a bit of time before it is tagged, but I should have something to play around with by tomorrow. I'd love to see what you put together for this task on your end, as hopefully I can either borrow or streamline what is necessary. |
I hope it works.
john verzani <[email protected]> schrieb am Mo., 8. Feb. 2021, 22:31:
… Neat. I'm hoping to make this easier for you. I'm almost done with a PR
that moves the polynomial symbol into the type parameter so things like
promote will just work. It took a fair amount of code churn, so might be a
bit of time before it is tagged, but I should have something to play around
with by tomorrow. I'd love to see what you put together for this task on
your end, as hopefully I can either borrow or streamline what is necessary.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#308 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALJDHEHSILEG6HFKARK5URLS6BJ2JANCNFSM4XEY24RQ>
.
|
Another try. |
Please use this version |
Thanks. Before I dive in, do you have some test suite?
…On Tue, Feb 9, 2021 at 7:15 AM Andreas Varga ***@***.***> wrote:
Please use this version
polynomial_concatenations.zip
<https://github.com/JuliaMath/Polynomials.jl/files/5951254/polynomial_concatenations.zip>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#308 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADG6TGXWHHDZE3MFOSJR5LS6ERO5ANCNFSM4XEY24RQ>
.
--
John Verzani
Department of Mathematics
College of Staten Island, CUNY
[email protected]
|
Just to be clear, with my current branch, I can do all this before adding
your modifications, but am not sure what more you are seeking:
```
julia> p = Polynomial([1,2,3], :y)
Polynomial(1 + 2*y + 3*y^2)
julia> A = [1 p; p^2 p]
2×2 Array{Polynomial{Int64,:y},2}:
Polynomial(1) Polynomial(1 + 2*y + 3*y^2)
Polynomial(1 + 4*y + 10*y^2 + 12*y^3 + 9*y^4) Polynomial(1 + 2*y + 3*y^2)
julia> vcat(A,I)
4×2 Array{Polynomial{Int64,:y},2}:
Polynomial(1) Polynomial(1 + 2*y + 3*y^2)
Polynomial(1 + 4*y + 10*y^2 + 12*y^3 + 9*y^4) Polynomial(1 + 2*y + 3*y^2)
Polynomial(1) Polynomial(0)
Polynomial(0) Polynomial(1)
julia> hcat(A,I)
2×4 Array{Polynomial{Int64,:y},2}:
Polynomial(1) … Polynomial(1)
Polynomial(0)
Polynomial(1 + 4*y + 10*y^2 + 12*y^3 + 9*y^4) Polynomial(0)
Polynomial(1)
julia> hvcat((2,2), A,I,A,I)
4×4 Array{Polynomial{Int64,:y},2}:
Polynomial(1) … Polynomial(1)
Polynomial(0)
Polynomial(1 + 4*y + 10*y^2 + 12*y^3 + 9*y^4) Polynomial(0)
Polynomial(1)
Polynomial(1) Polynomial(1)
Polynomial(0)
Polynomial(1 + 4*y + 10*y^2 + 12*y^3 + 9*y^4) Polynomial(0)
Polynomial(1)
```
But this is failing:
```
julia> A + I
ERROR: MethodError: convert(::Type{Union{}}, ::Polynomial{Int64,:y}) is
ambiguous.
```
…On Tue, Feb 9, 2021 at 7:36 AM John Verzani ***@***.***> wrote:
Thanks. Before I dive in, do you have some test suite?
On Tue, Feb 9, 2021 at 7:15 AM Andreas Varga ***@***.***>
wrote:
> Please use this version
> polynomial_concatenations.zip
> <https://github.com/JuliaMath/Polynomials.jl/files/5951254/polynomial_concatenations.zip>
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#308 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AADG6TGXWHHDZE3MFOSJR5LS6ERO5ANCNFSM4XEY24RQ>
> .
>
--
John Verzani
Department of Mathematics
College of Staten Island, CUNY
***@***.***
--
John Verzani
Department of Mathematics
College of Staten Island, CUNY
[email protected]
|
Apparently you can do everything what I can also do! Or perhaps not ? try Just in case you would like to have a look at the last version: |
Unfortunately, I have now the problem:
Do you know a trick to avoid executing my code and falling back to the standard linear algebra code? |
Just wait :)
I should have these changes on a branch soon that you can explore. Since it
is breaking (technically) I want to get in a few other breaking changes
before I tag.
As for your last example, I still have some work to do:
```
julia> [ A rand(2,2);I;[1 2p im 3.]]
ERROR: TypeError: in typeassert, expected Polynomial{Complex{Float64},:y},
got a value of type Polynomial{Int64,:y}
```
…On Tue, Feb 9, 2021 at 9:42 AM Andreas Varga ***@***.***> wrote:
Unfortunately, I have now the problem:
[zeros(2,2) I]
2×4 Array{Polynomial{Float64},2}:
Polynomial(0.0) Polynomial(0.0) Polynomial(1.0) Polynomial(0.0)
Polynomial(0.0) Polynomial(0.0) Polynomial(0.0) Polynomial(1.0)
Do you know a trick to avoid executing my code and falling back to the
standard linear algebra code?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#308 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADG6TAT7TZLBFCNJBUWFV3S6FCWXANCNFSM4XEY24RQ>
.
--
John Verzani
Department of Mathematics
College of Staten Island, CUNY
[email protected]
|
#310 contains a PR that moves the symbol into a type parameter. It should help clean up what you need quite a bit (and maybe reduce your modifications to none). Let me know how it goes. |
I finished with my implementation of Polynomial concatenations. This was a good exercise which now serves as basis of implementing similar software for rational transfer functions. Such an object I defined as:
The sampling time Could you tell me what impact will have your changes on my (an other) software relying on PS. I don't know how to use #310. Probably, the best is for me to wait (patiently) the final result of your modification. |
Thanks. I don't have time right now for review, but on first glance this is how I would approach it. (One thing the construct As for moving Ts into the type, I'd think that would be an issue if there were many possible values, as it would mean different types for each problem, and hence many recompilations. For the symbol that isn't really the expected case. Though if there were a few, then sure that might be useful for the same reason moving the symbol up to that level is. As for using #310, I think you can:
(hopefully :) |
It works ! Congratulations! I wonder if you must use
|
I might have this wrong, but I think == is enough, thought I have seen === used as well. I can certainly change it, I don't see the harm and perhaps there are benefits I'm unaware of. Let me know if I got this setup correctly for your use. It is a lot of code churn and hopefully makes your task much simpler if not ready made. |
Would you suggest to modify my codes to use the new Polynomials? When do
you think the changes go into a next release ?
john verzani <[email protected]> schrieb am Mi., 10. Feb. 2021,
20:20:
… I might have this wrong, but I think == is enough, thought I have seen ===
used as well. I can certainly change it, I don't see the harm and perhaps
there are benefits I'm unaware of.
Let me know if I got this setup correctly for your use. It is a lot of
code churn and hopefully makes your task much simpler if not ready made.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#308 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALJDHEBMNDSZC34JCDOWVVTS6LL7JANCNFSM4XEY24RQ>
.
|
Hopefully in a week or two I’ll tag a release.
On Wed, Feb 10, 2021 at 3:59 PM Andreas Varga ***@***.***> wrote:
Would you suggest to modify my codes to use the new Polynomials? When do
you think the changes go into a next release ?
john verzani ***@***.***> schrieb am Mi., 10. Feb. 2021,
20:20:
> I might have this wrong, but I think == is enough, thought I have seen
===
> used as well. I can certainly change it, I don't see the harm and perhaps
> there are benefits I'm unaware of.
>
> Let me know if I got this setup correctly for your use. It is a lot of
> code churn and hopefully makes your task much simpler if not ready made.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <
#308 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/ALJDHEBMNDSZC34JCDOWVVTS6LL7JANCNFSM4XEY24RQ
>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#308 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADG6TFHJDE74ILQEBK6EITS6LXS3ANCNFSM4XEY24RQ>
.
--
John Verzani
Department of Mathematics
College of Staten Island, CUNY
[email protected]
|
This is a short account of my first experince moving to the new I started to modify the software in MatrixPencils.jl to comply with the new setup of In some cases I just added a new call as below:
In other cases this duplication was not possible, since I received errors complainig of ambiguous methods, but the code works without any change! Apparently the type And some cases I was not able to manage with either of the two approaches. For example, I got a polynomial matrix displayed as:
Question: I wonder if Q is a valid polynomial matrix, since I expected So, I added a method for this type too, as below:
The value of Is any systematics which you could recommed for complying with both old and new versions? In this moment, it seems to me to be a matter of trials and errors. |
With the new structure, we could consider the following structures:
The first three are clearly different, but the last two are the same, because
The question is: in the most general case of a polynomial matrix input the |
How is |
Maybe you want |
The following commands lead to X, Q and R which escape the promotion mechanism:
|
Yes indeed. The issue is promote between containers with polynomials. In this example there is no promotion between Tuple{P{Int,:X},2) and Tuple{P{Float64,:X},2) which is understandable, tuples and all. But I naively expected that if I made those Vectors (in I'm not sure where to do this, but this pattern works:
|
Sorry disturbing you once again. I started to update my current projects to use During transition of MatrixPencils.jl, I got a message from the
to
in order to support previous versions working with I wonder if this has any sense for me. I would appreciate learning what is your opinion in this respect and if this is also an issue for you, i.e., to comply with the previous versions inside |
I'll have to look. My guess would be that if you do one of three things some workaround will be needed:
I should be able to have a look next week through your package if the above isn't enough guidance. |
I would appreciate very much if you could reveal how you enforce the polynomial type of elements in a polynomial matrix construct, as for example in the following vertical concatenation example:
I am trying to implement a
RationalTransferFunction
type, where in a vertical concatenation I am getting an array ofAny
(instead an array ofRationalTransferFunction)
, as below:Many thank in advance for your advice.
The text was updated successfully, but these errors were encountered: