Skip to content

Moebius Transform Operator and Tustin's method for LTI-Systems#1614

Merged
renefritze merged 30 commits into
pymor:mainfrom
artpelling:moebius-transform
Jul 11, 2022
Merged

Moebius Transform Operator and Tustin's method for LTI-Systems#1614
renefritze merged 30 commits into
pymor:mainfrom
artpelling:moebius-transform

Conversation

@artpelling

@artpelling artpelling commented Apr 20, 2022

Copy link
Copy Markdown
Member

I have this code here that I would like to integrate in order to have Bilinear Transformations of LTI-systems similarly to Matlabs c2d and d2c commands. So far I have implemented Tustin's method and I am looking to extend this to higher order approximations in the future.

I am particularly interested in arbitrary Moebius substitutions of the frequency argument (not only the bilinear transformation) which is why I chose a more functional approach and implemented a MoebiusTransform operator directly. Maybe this can be used elsewhere in the future (I have added the CayleyTransform as an inspiration).

I would love to get some feedback, IMO the method LTIModel.moebius_substitution could use some improvement in both naming and the code. The method substitutes the frequency argument omega by a MoebiusTransform (please see https://ieeexplore.ieee.org/document/489281/ for reference). I feel like I am not using pyMORs structure optimally in the current implementation.

The docstrings are sparse and sketchy, I will obviously add proper ones and tests at a later stage.

@codecov

codecov Bot commented Apr 20, 2022

Copy link
Copy Markdown

Codecov Report

Merging #1614 (fa218ff) into main (90ca18d) will decrease coverage by 11.27%.
The diff coverage is 90.08%.

Impacted Files Coverage Δ
src/pymor/algorithms/to_matrix.py 88.23% <77.27%> (-10.43%) ⬇️
src/pymor/models/transforms.py 92.53% <92.53%> (ø)
src/pymor/models/iosys.py 80.66% <93.75%> (+0.49%) ⬆️
src/pymordemos/fenics_nonlinear.py 0.00% <0.00%> (-97.30%) ⬇️
src/pymordemos/neural_networks_instationary.py 0.00% <0.00%> (-97.02%) ⬇️
src/pymordemos/neural_networks.py 0.00% <0.00%> (-96.43%) ⬇️
src/pymordemos/neural_networks_fenics.py 0.00% <0.00%> (-92.96%) ⬇️
src/pymor/reductors/neural_network.py 0.51% <0.00%> (-92.21%) ⬇️
src/pymor/tools/io/vtk.py 3.44% <0.00%> (-91.38%) ⬇️
src/pymor/models/neural_network.py 2.27% <0.00%> (-89.78%) ⬇️
... and 74 more

Comment thread src/pymor/operators/numpy.py Outdated
Comment thread src/pymor/models/iosys.py Outdated
Comment thread src/pymor/models/iosys.py Outdated
Comment thread src/pymor/algorithms/to_matrix.py Outdated
Comment thread src/pymor/models/iosys.py Outdated
@artpelling artpelling force-pushed the moebius-transform branch 2 times, most recently from c458e48 to 14a204b Compare April 27, 2022 15:11
@pymor-lab-hub-bridge

Copy link
Copy Markdown

Hey @artpelling it looks like this PR touches our CI config (and you are not in my contributor safelist), therefore I am not starting a gitlab-ci build for it and it will not be mergeable.

Comment thread src/pymor/models/transforms.py Outdated
Comment thread src/pymor/models/transforms.py Outdated
@pymor-lab-hub-bridge

Copy link
Copy Markdown

Hey @artpelling it looks like this PR touches our CI config (and you are not in my contributor safelist), therefore I am not starting a gitlab-ci build for it and it will not be mergeable.

@artpelling

Copy link
Copy Markdown
Member Author

I have somehow messed up the history again. @pmli if you are okay with the current state, I can rebase on main, squash everything into one commit and convert this to a non-draft PR.

Comment thread src/pymor/models/transforms.py Outdated
@pmli

pmli commented Apr 28, 2022

Copy link
Copy Markdown
Member

I have somehow messed up the history again. @pmli if you are okay with the current state, I can rebase on main, squash everything into one commit and convert this to a non-draft PR.

Rebasing would also make it easier to review. You don't have to squash it into one commit, e.g., using one commit per file changed would make the git history nicer (also, we often use git commit messages of the form [module] short message, but we do not really enforce it).

@artpelling artpelling force-pushed the moebius-transform branch from cff0d12 to 429a78a Compare May 2, 2022 17:18
@artpelling artpelling marked this pull request as ready for review May 2, 2022 17:46
@pmli pmli added the pr:new-feature Introduces a new feature label May 2, 2022
@pmli pmli added this to the 2022.1 milestone May 2, 2022

@pmli pmli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks to me to be in a good shape. What is left are docstrings and some unit tests.

Comment thread src/pymor/algorithms/to_matrix.py Outdated
@artpelling artpelling force-pushed the moebius-transform branch from b5e2427 to 2bbf866 Compare May 2, 2022 20:16
@artpelling

Copy link
Copy Markdown
Member Author

I renamed MoebiusTransform to MoebiusTransformation, because apparently the former refers to Möbius' inversion formula. This leads to inconsistent but correct naming of the derived classes.

Comment thread src/pymor/models/iosys.py Outdated
Comment thread src/pymor/models/iosys.py Outdated
Comment thread src/pymor/models/transforms.py Outdated
Comment thread src/pymor/models/transforms.py
Comment thread src/pymor/models/transforms.py Outdated
Comment thread src/pymor/models/transforms.py Outdated
Comment thread src/pymor/models/transforms.py Outdated
Comment thread src/pymor/models/transforms.py Outdated
Comment thread src/pymor/models/transforms.py
@pmli

pmli commented May 3, 2022

Copy link
Copy Markdown
Member

It would be good to add tests for Moebius transformations and maybe also for to_discrete and to_continuous methods.

Also, now that it's settled that these transformations are not Operators, maybe __mul__ instead of __matmul__ is better? Or would that be confused with the elementwise product of functions?

@artpelling artpelling force-pushed the moebius-transform branch from 22c5c0a to 1b597c4 Compare May 30, 2022 12:59
@pymor-lab-hub-bridge

Copy link
Copy Markdown

Hey @artpelling it looks like this PR touches our CI config (and you are not in my contributor safelist), therefore I am not starting a gitlab-ci build for it and it will not be mergeable.

@artpelling artpelling force-pushed the moebius-transform branch 2 times, most recently from 22c5c0a to aa5e13e Compare May 31, 2022 08:05
@pymor-lab-hub-bridge

Copy link
Copy Markdown

Hey @artpelling it looks like this PR touches our CI config (and you are not in my contributor safelist), therefore I am not starting a gitlab-ci build for it and it will not be mergeable.

1 similar comment
@pymor-lab-hub-bridge

Copy link
Copy Markdown

Hey @artpelling it looks like this PR touches our CI config (and you are not in my contributor safelist), therefore I am not starting a gitlab-ci build for it and it will not be mergeable.

@github-actions github-actions Bot added the infrastructure Buildsystem, packages and CI label May 31, 2022
@pymor-lab-hub-bridge

Copy link
Copy Markdown

Hey @artpelling it looks like this PR touches our CI config (and you are not in my contributor safelist), therefore I am not starting a gitlab-ci build for it and it will not be mergeable.

@renefritze

Copy link
Copy Markdown
Member

I've add you to the safelist now @artpelling , so this message should disappear with the next push/commit.

@sdrave

sdrave commented Jul 5, 2022

Copy link
Copy Markdown
Member

@artpelling, the problem with the failing test was that you are not allowed to call as_range_array on an Operator which has something different than a NumpyVectorSpace as source. I have moved the fallback in to_matrix to an additional as_array action. As this should also work for the children in the Concatenation, I do not think it is necessary to catch NoMatchingRuleError.

Further I have reverted your streamlined version of the matrix-matrix products as it seems to neglect one optimization for sparse-dense products.

@renefritze renefritze merged commit f968478 into pymor:main Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:new-feature Introduces a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants