Title: Complex numbers in state space matrices get cast to real in `control.StateSpace(...)` constructor - a bug? · Issue #1058 · python-control/python-control · GitHub
Open Graph Title: Complex numbers in state space matrices get cast to real in `control.StateSpace(...)` constructor - a bug? · Issue #1058 · python-control/python-control
X Title: Complex numbers in state space matrices get cast to real in `control.StateSpace(...)` constructor - a bug? · Issue #1058 · python-control/python-control
Description: I noticed that if I have complex numbers in my A,B,C,D state space matrices, there's casting complex numbers to real in control.StateSpace(A,B,C,D) which does not appear to be right (?) if there's imaginary part. Is it intentional? Is th...
Open Graph Description: I noticed that if I have complex numbers in my A,B,C,D state space matrices, there's casting complex numbers to real in control.StateSpace(A,B,C,D) which does not appear to be right (?) if there's ...
X Description: I noticed that if I have complex numbers in my A,B,C,D state space matrices, there's casting complex numbers to real in control.StateSpace(A,B,C,D) which does not appear to be right (?) if ther...
Opengraph URL: https://github.com/python-control/python-control/issues/1058
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Complex numbers in state space matrices get cast to real in `control.StateSpace(...)` constructor - a bug?","articleBody":"I noticed that if I have complex numbers in my A,B,C,D state space matrices, there's casting complex numbers to real in `control.StateSpace(A,B,C,D)` which does not appear to be right (?) if there's imaginary part. Is it intentional? Is there a way around it?\r\n\r\nSpecifically, I think this line is responsible: https://github.com/python-control/python-control/blob/main/control/statesp.py#L2170. Note `dtype=float`. I have matrices with `dtype=complex128`. Minimally reproducible example (matrices are completely made up here, of course the real state space I'm working with is more realistic but also much bigger):\r\n\r\n```python\r\nfrom control import StateSpace\r\nimport numpy as np\r\nA = np.array([[1+1j,1+1j],[1+1j,1+1j]])\r\nB = np.array([[1+1j,1+1j],[1+1j,1+1j]])\r\nC = np.array([[1+1j,1+1j],[1+1j,1+1j]])\r\nD = np.array([[1+1j,1+1j],[1+1j,1+1j]])\r\nss = StateSpace(A,B,C,D)\r\n```\r\nresults in \r\n```statesp.py:2170: ComplexWarning: Casting complex values to real discards the imaginary part arr = np.array(data, dtype=float)```","author":{"url":"https://github.com/artem-basalaev","@type":"Person","name":"artem-basalaev"},"datePublished":"2024-11-13T14:52:02.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1058/python-control/issues/1058"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f53a3e99-203a-6747-a131-78f14225ce2a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C92E:36F5DF:1B5D9B9:2505C20:69798D4B |
| html-safe-nonce | 41f09ee6f5016266c21c789aef2280c7a93f693aa32c13278318352e2628db81 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOTJFOjM2RjVERjoxQjVEOUI5OjI1MDVDMjA6Njk3OThENEIiLCJ2aXNpdG9yX2lkIjoiNjgyNjUyNTAzNzU0OTk0ODIzNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 69d8055ccbe19bd73f37bc0430ac3e7a69fb0b8d28d6ed9b41f13febad6d4319 |
| hovercard-subject-tag | issue:2655778812 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-control/python-control/1058/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9c790331b2f4f5f35452b1a59fc5c668e9eced7d8ad56fdddff13650ea740b9b/python-control/python-control/issues/1058 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9c790331b2f4f5f35452b1a59fc5c668e9eced7d8ad56fdddff13650ea740b9b/python-control/python-control/issues/1058 |
| og:image:alt | I noticed that if I have complex numbers in my A,B,C,D state space matrices, there's casting complex numbers to real in control.StateSpace(A,B,C,D) which does not appear to be right (?) if there's ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | artem-basalaev |
| hostname | github.com |
| expected-hostname | github.com |
| None | c049b65ec7e54cbf2521f5a560b6527714c612b0bd169188e2ea6e16f83bd5f4 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-control/python-control git https://github.com/python-control/python-control.git |
| octolytics-dimension-user_id | 2285872 |
| octolytics-dimension-user_login | python-control |
| octolytics-dimension-repository_id | 22791752 |
| octolytics-dimension-repository_nwo | python-control/python-control |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 22791752 |
| octolytics-dimension-repository_network_root_nwo | python-control/python-control |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 87b137883e35e2766c3d0f6a257c4044f6390b83 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width