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

allow complex statespace matrices #484

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bnavigator
Copy link
Contributor

Outsourced from #438, because it is not directly related to the test suite.

To be combined with #376

@coveralls
Copy link

coveralls commented Dec 30, 2020

Coverage Status

Coverage increased (+0.005%) to 86.624% when pulling 0fda8c0 on bnavigator:complex-statespace into 51c797e on python-control:master.

@bnavigator bnavigator linked an issue Dec 30, 2020 that may be closed by this pull request
@roryyorke
Copy link
Contributor

I suspect this might be quite a lot of work to properly support (see below).

Would we change Slycot to reject complex matrices when real are expected? This might be a good idea anyway.

Would we support TFs with complex coefficients?

In [15]: import control as ct

In [16]: import control.matlab as ml

In [17]: ct.gram(ct.ss(-1-1j, 2, 3, 4), 'o')
/home/rory/.miniconda3/envs/controldev/lib/python3.8/site-packages/slycot/synthesis.py:792: ComplexWarning: Casting complex values to real discards the imaginary part
  out = _wrapper.sb03md(dico,n,C,A,U,job=job,fact=fact,trana=trana,ldwork=ldwork)
Out[17]: matrix([[4.5]])

In [18]: y, t = ml.step(ct.ss(-1-1j, 2, 3, 4)); y[1]
/home/rory/src/python-control/control/timeresp.py:376: ComplexWarning: Casting complex values to real discards the imaginary part
  xout[:, i] = (dot(Ad, xout[:, i-1]) + dot(Bd0, U[:, i-1]) +
Out[18]: 4.26995014112991

@bnavigator
Copy link
Contributor Author

ComplexWarning: Casting complex values to real discards the imaginary part

Also, see discussion in #376. We could set a warning filter making this an error in Slycot.

@LSchmerber
Copy link

Hi,
First, thanks for this library.
I still have the complex values to float issue when starting matrix creation from complex eigen values and with Rev 0.9.0
image

@rico500
Copy link

rico500 commented Aug 29, 2022

Has the development for this feature been discontinued? Is there a big road-block depending on another package (slycot?)?

@lytex
Copy link

lytex commented Sep 20, 2022

If I remember correctly, Slycot had some functions that could be easily extended to handle complex cases
#376 (comment)
However,

tb05ad_ng and tb04ad_r are casting complex values to real, but as far as I know it seems there are no complex routine equivalents to these functions

@bnavigator
Copy link
Contributor Author

The main roadblock is probably developer time. I might resuming working on this not earlier than in 2 or 3 months. Contributions from others are always welcome of course.

@bnavigator bnavigator closed this Feb 18, 2024
@bnavigator bnavigator deleted the complex-statespace branch February 18, 2024 20:29
@bnavigator bnavigator restored the complex-statespace branch February 18, 2024 20:32
@bnavigator bnavigator reopened this Feb 18, 2024
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.

Complex state matrices
6 participants