Skip to content

vectorize FRD feedback function #680

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

Merged
merged 2 commits into from
Dec 26, 2021

Conversation

bnavigator
Copy link
Contributor

This is a TODO from #314. It overlaps with #679 and one or the other needs a rebase after merge.

# frd_bench.py
from control import FrequencyResponseData, rss
import numpy as np

omega = np.logspace(-1, 4, 40000)

rss1 = rss(6,10,20,True)
rss2 = rss(6,20,10,True)

F1 = rss1(omega)
F2 = rss2(omega)

frd1 = FrequencyResponseData(F1, omega)
frd2 = FrequencyResponseData(F2, omega)

FB = frd1.feedback(frd2)

current master:

In [1]: from frd_bench import frd1,frd2

In [2]: %timeit -n 10 -r 3 frd1.feedback(frd2)
1.96 s ± 10.8 ms per loop (mean ± std. dev. of 3 runs, 10 loops each)

vectorized:

In [1]: from frd_bench import frd1,frd2

In [2]: %timeit -n 10 -r 3 frd1.feedback(frd2)
1.29 s ± 4.48 ms per loop (mean ± std. dev. of 3 runs, 10 loops each)

@coveralls
Copy link

coveralls commented Dec 2, 2021

Coverage Status

Coverage increased (+0.002%) to 92.723% when pulling 37c95b6 on bnavigator:vector-frd-feedback into 4f681ab on python-control:master.

@bnavigator
Copy link
Contributor Author

It overlaps with #679 and one or the other needs a rebase after merge.

Done.

@murrayrm murrayrm merged commit 2ce4bbd into python-control:master Dec 26, 2021
@murrayrm murrayrm added this to the 0.9.1 milestone Dec 30, 2021
@bnavigator bnavigator deleted the vector-frd-feedback branch February 18, 2024 20:30
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

Successfully merging this pull request may close these issues.

3 participants