Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Complex numbers in state space matrices get cast to real incontrol.StateSpace(...) constructor - a bug? #1058

Open
@artem-basalaev

Description

@artem-basalaev

I noticed that if I have complex numbers in my A,B,C,D state space matrices, there's casting complex numbers to real incontrol.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?

Specifically, I think this line is responsible:https://github.com/python-control/python-control/blob/main/control/statesp.py#L2170. Notedtype=float. I have matrices withdtype=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):

fromcontrolimportStateSpaceimportnumpyasnpA=np.array([[1+1j,1+1j],[1+1j,1+1j]])B=np.array([[1+1j,1+1j],[1+1j,1+1j]])C=np.array([[1+1j,1+1j],[1+1j,1+1j]])D=np.array([[1+1j,1+1j],[1+1j,1+1j]])ss=StateSpace(A,B,C,D)

results in
statesp.py:2170: ComplexWarning: Casting complex values to real discards the imaginary part arr = np.array(data, dtype=float)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp