-
Notifications
You must be signed in to change notification settings - Fork 109
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
[algorithms.samdp] add samdp algorithm #834
Conversation
Hi @lbalicki, thanks for the PR. Adding a test in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave mostly minor cosmetic comments. I'll take a closer look at the algorithm later.
I made the suggested changes and in order to be more consistent with the other algorithms I decided to change the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are some mostly minor issues (found using pylint
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more minor remarks below.
I tried running the code with the building model from SLICOT:
from pymor.basic import *
from pymor.algorithms.samdp import samdp
build = LTIModel.from_mat_file('build.mat')
dp = samdp(build.A, build.E, build.B.as_range_array(), build.C.as_source_array(), 2)
but I get NaNs appearing.
I had set the default initial shift to zero, which seems to cause problems in some cases. Now, if no initial shifts are provided, a random complex shift is used. For me the model from SLICOT works this way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some improvements concerning NumPy and converting from Matlab to Python style (e.g., it is more natural for residues[i]
, i.e. residues[i, :, :]
, to be the i
th residue instead of residues[:, :, i]
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the changes, @lbalicki. I've added some more comments below.
I've tried the code with almost all SLICOT benchmarks and it works very well except for the CDplayer benchmark. For that example, samdp
gave me a result only when nwanted
is 1. @lbalicki, do you get the same? Do you see if changing some options could improve things? I guess it could simply be a badly conditioned problem (LR-ADI also has issues with it, as far as I remember). So, either way, I would be for merging after the changes below.
It seems like there was still an issue when the eigenvectors of the dominant poles were complex. With the changes I have made, the CDplayer model from SLICOT works even with large values for |
Ok, great, CDplayer is working nicely, and a few other benchmarks also perform better (e.g., random). I have a few more comments now:
|
Regarding 1. and 2. I just added a For 3. I changed the default tolerances to |
Ok, interesting. I guess the algorithm is really sensitive to the choices of the tolerances. I tried the new tolerances for the 'random' example in the SLICOT benchmark and it looks like Also, it would be good to return the test for |
It seems like the problem with the My suggestion would be to print a warning if For the tests I would maybe change |
It makes sense to me. |
Now the rail1357 example (for |
I made a few changes which make the algorithm more stable. Also, dealing with complex poles works better now. |
It looks like there are now similar issues for the transmission line model from SLICOT. For |
Comparing with the poles computed by |
These are the poles I get for tline model, colored by dominance (log10 of norm(residual)/norm(pole.real)): The results were generated using tline_samdp.zip |
It seems that this happened because I switched to relative tolerances for the residuals. After some testing it seems that absolute tolerances work better for almost all examples. One example that does not work better is the filter2D model. I get a complex pole for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that samdp
works well for all the SLICOT benchmarks I tried.
From what I've heard from @drittelhacker, sensitivity to tolerances is somewhat acceptable with this algorithm.
I would not exactly say "acceptable" but "to be expected" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good to me, although I cannot really comment on the algorithmic details. @lbalicki, you should add an entry to AUTHORS.md
..
…y difference check
It's merged. Thank you, @lbalicki. |
I implemented the the subspace accelerated dominant pole algorithm (https://ieeexplore.ieee.org/document/1717547) which computes the dominant poles of the transfer function of a LTI system. It can be used in the future to add modal MOR methods to pyMOR.