Skip to content

Commit e6f2f60

Browse files
committed
allow _ssmatrix to accept complex values
1 parent 66bee9d commit e6f2f60

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

control/statesp.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,15 @@ def _ssmatrix(data, axis=1):
9393
# Convert the data into an array or matrix, as configured
9494
# If data is passed as a string, use (deprecated?) matrix constructor
9595
if config.defaults['statesp.use_numpy_matrix'] or isinstance(data, str):
96-
arr = np.matrix(data, dtype=float)
96+
if np.isrealobj(data):
97+
arr = np.matrix(data, dtype=float)
98+
elif np.iscomplexobj(data):
99+
arr = np.matrix(data, dtype=complex)
97100
else:
98-
arr = np.array(data, dtype=float)
101+
if np.isrealobj(data):
102+
arr = np.array(data, dtype=float)
103+
elif np.iscomplexobj(data):
104+
arr = np.array(data, dtype=complex)
99105
ndim = arr.ndim
100106
shape = arr.shape
101107

0 commit comments

Comments
 (0)